package com.refusea.train.domain.entity


data class LessonScheduleConfig(
    var id: Int,
    var schoolId: Int,
    val workdayHour: String,
    val holidayHour: String,
    val halfHour: Boolean,
) {
    companion object {

        private val WORKDAY_HOUR = generate(17, 18, 19)
        private val HOLIDAY_HOUR = generate(9, 10, 11, 14, 15, 16, 17, 18, 19)

        fun default(schoolId: Int): LessonScheduleConfig {
            return LessonScheduleConfig(
                0,
                schoolId,
                WORKDAY_HOUR,
                HOLIDAY_HOUR,
                true,
            )
        }

        private fun generate(vararg hours: Int): String {
            val result = CharArray(24) { '0' }
            hours.forEach { result[it] = '1' }
            return String(result)
        }
    }
}
